package cn.zjjd.homeworkserver.service;

import cn.zjjd.homeworkserver.dao.UserDao;
import cn.zjjd.homeworkserver.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: 小胡
 * @create: 2022/12/20
 * @Description:
 * @FileName: UserService
 * @Version: 1.0
 */
@Service
public class UserService {
    @Autowired
    UserDao userDao;
    public User addUser(User user){
        return userDao.save(user);
    }
    public List<User> queryAllUser(){
        return userDao.findAll();
    }
    public User queryUserById(int id){
        return userDao.getOne(id);
    }
    public void deleteUserById(int id){
        userDao.deleteById(id);
    }
    public User updateUser(User user){
        return userDao.save(user);
    }
}
